/*
 * Copyright (c) 2006-2021, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2023-02-07     HZHJYYJQR       the first version
 */
#ifndef APPLICATIONS_APP_APP_NFC_H_
#define APPLICATIONS_APP_APP_NFC_H_

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

#include "bsp/bsp.h"


typedef struct{
//    uint32_t total;  //设置的使用次数
//    uint32_t remain;   //剩余的使用次数
    char*     _string;  //nfc储存字符串     //20230525
    uint8_t  findcardstatus;
    uint8_t  AntiCollisionstatus;
    uint8_t  SelectCardststus;
    uint8_t  Attestatestatus;
    uint8_t  Actual_Step;
    uint8_t  Readcardstatus;
    uint8_t  Writecardstatus;
    uint8_t  cardtype[2]; //卡片型号
    uint8_t  cardtype_len;  //卡片型号长度
    uint8_t  cardnum[8];  //卡号
    uint8_t  cardnum_len ;//卡号长度
//    uint8_t  message[16];//写卡数据
}NFC;

extern NFC m_nfc;

void nfc_findcard_send(void);
void nfc_AntiCollisionCmd_send(uint8_t* buff,uint8_t buf_len);
void nfc_SelectCardCmd_send(uint8_t* buff,uint8_t buf_len);
void nfc_CardCertificateCmd_send(uint8_t passwordtype,uint8_t blocknum);
void nfc_OneKeyReadCardCmd_send(uint8_t blocknum);
void nfc_OneKeyWriteCardCmd_send(uint32_t m_total,uint32_t m_remain,uint8_t blocknum);
void nfc_OneKeyWriteCardCmd(char *buff,uint8_t blocknum);
void nfc_initvaluecard_send(void);
void nfc_ReadValue_send(void);
void nfc_ReCharge_send(uint32_t ReChargeValue);
void nfc_Decrease_send(uint32_t DecreaseValue);

#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif /* APPLICATIONS_APP_APP_NFC_H_ */
